//
//  Flat.m
//  FinApp
//
//  Created by Victor Leandro Fernandez Rodrigo on 12/11/11.
//  Copyright (c) 2011 FIB-Fàcultat d'informàtica de Barcelona. All rights reserved.
//

#import "Flat.h"


@implementation Flat

@synthesize equipment, description;


+ (Flat*)flatFromDictionary:(NSDictionary*)flatDictionary {
    Flat *newFlat = [[[Flat alloc] init] autorelease];
    [newFlat setIdFlat:[[flatDictionary objectForKey:@"idPis"] intValue]];
    [newFlat setStreet:[flatDictionary objectForKey:@"carrer"]];
    [newFlat setCity:[flatDictionary objectForKey:@"poblacio"]];
    [newFlat setFlatType:[flatDictionary objectForKey:@"tipus"]];
    [newFlat setDimensions:[[flatDictionary objectForKey:@"superficie"] intValue]];
    [newFlat setNumRooms:[[flatDictionary objectForKey:@"numHabitacions"] intValue]];
    [newFlat setPrice:[[flatDictionary objectForKey:@"preu"] floatValue]];
    [newFlat setImageURL:[flatDictionary objectForKey:@"imageURL"]];
    [newFlat setLatitude:[[flatDictionary objectForKey:@"latitut"] floatValue]];
    [newFlat setLongitude:[[flatDictionary objectForKey:@"longitut"] floatValue]];
    [newFlat setEquipment:[flatDictionary objectForKey:@"equipament"]];
    [newFlat setDescription:[flatDictionary objectForKey:@"descripcio"]];
    return newFlat;
}

@end
